<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.wiseMen.platform.security.SessionUserUtils"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/pages/common/taglib.jsp" %>
<%
    request.setAttribute("currUser", SessionUserUtils.getCurrendUser());
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>NTKO office控件</title>
<%@ include file="/common/includeCoreCssJs.jsp" %>
<script src="${ctx}/res/components/ntkofunction.min.js"></script>
</head>
<body>
<div class="am-margin-xs">
	<button type="button" class="am-btn am-btn-primary am-btn-sm" id="saveBt">保存</button>
	<button type="button" class="am-btn am-btn-secondary am-btn-sm" id="drawBt">手写批注</button>
</div>
<!--控件对象-->
<div>
	<script src="${ctx}/res/components/ntkoofficecontrol.min.js"></script>
</div>
	
<%@ include file="/common/includeUiScript.jsp" %>
<script type="text/javascript">
var officeControl;
$(function(){
	var id='${param.id}';
	officeControl=new OfficeControl();
	if(id){
		officeControl.open(id,false);
	}else{
		officeControl.ocx.CreateNew("Word.Document");
	}
	
	$("#saveBt").click(function(){
		/**
		订阅方法
		var sub = top.webUtils.topicSubscribe("officeCtr.edit.success", function (args) {
                            obj.id;
                        });
		**/
		officeControl.save(id,function(result){
		    id=result.obj.id;
		    opener.top.webUtils.topicPublish("officeCtr.edit.success", result.obj);
			if(confirm("保存成功，请问是否关闭")){
				 window.close();
			}
		});
	});
	
	$("#drawBt").click(function(){
		officeControl.doHandDraw();
	});
	
});
</script>
</body>
</html>